//1833.雪糕的最大数量
//https://leetcode.cn/problems/maximum-ice-cream-bars/description/
class Solution {
public:
    int maxIceCream(vector<int>& costs, int coins) {
        sort(costs.begin(),costs.end());
        int ret = 0;
        for(int& x:costs)
        {
            if(x <= coins)
            {
                ++ret;
                coins -= x;
            }
            else return ret;
        }
        return ret;
    }
};